<?php
namespace app\index\controller;

use app\common\key\AdKey;
use app\common\lib\Geocoding;

/**
 * @description : [品牌控制器]
 * Class Brand
 * @package app\index\controller
 */
class Brand extends Base
{
    public function index()
    {
        $ad = $this->getAdByType(AdKey::TYPE_BRAND);
        $work = model('Work')->select();
        $history = model('BrandHistory')->select();
        $cogs = model('BrandCog')->select();

        $config = $this->config;
        $geo = Geocoding::getAddressComponent(
            'PBw9wnafmrxp5loOGMd0ht59',
            $config['LOCATION_LNG'],
            $config['LOCATION_LAT'],
            Geocoding::NO_POIS);

        $p = $geo['result']['addressComponent'];

        return $this->fetch('', [
            'ad' => $ad[0],
            'work' => $work,
            'history' => $history,
            'cogs' => $cogs,
            'geo' => $geo['result'],
            'addr' => $p['province'].$p['city'],
        ]);

    }
}
